import Http from "../utils/HttpUtil";
import URL from "./URL";

export default{
    // 查询轮播信息
    async  consultingBannerContent(){
        let url=URL.GetURL(URL.consultingBannerContent);
        return await(Http.Get(url))
        .then(response=>{
            return(response)
        },reject=>{
            return Promise.reject(reject);
        });
    },

    // 首页咨询和法律法规
    async  SelectHomeConsulting(type){
        let url=URL.GetURL(URL.SelectHomeConsulting);
        return await(Http.Get(url+"?type="+type))
        .then(response=>{
            return(response)
        },reject=>{
            return Promise.reject(reject);
        });
    },

    // 咨询或法律法规详情
    async  SelectConsultingDetails(consultingId){
        let url=URL.GetURL(URL.SelectConsultingDetails);
        return await(Http.Get(url+"?consultingId="+consultingId))
        .then(response=>{
            return(response)
        },reject=>{
            return Promise.reject(reject);
        });
    },

    // 咨询或法律法规列表
    async  SelectListConsulting(type){
        let url=URL.GetURL(URL.SelectListConsulting);
        return await(Http.Get(url+"?type="+type))
        .then(response=>{
            return(response)
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //资讯搜索
    async ConsultingSearch(content, type){
        let url=URL.GetURL(URL.ConsuLtingSearch)+`?content=${content}&type=${type}`;
        return await(Http.Get(url))
        .then(response=>{
            return(response)
        },reject=>{
            return Promise.reject(reject);
        });
    }
}